package com.github.wxiaoqi.security.crm.core.feignserver;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.github.wxiaoqi.security.common.crm.request.UnFreAndOutAccountRequest;
import com.github.wxiaoqi.security.common.crm.request.WithdrawApplyRequest;
import com.github.wxiaoqi.security.common.crm.request.WithdrawUnFreAndOutAccountRequest;
import com.github.wxiaoqi.security.common.crm.request.WithdrawUnFreezeRequest;
import com.github.wxiaoqi.security.crm.core.biz.RefundOutAccountBiz;
import com.github.wxiaoqi.security.crm.core.biz.RefundUnFreAndOutAccountBiz;
import com.github.wxiaoqi.security.crm.core.biz.WithdrawCommonBiz;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/***
 * 提现相关的接口
 * */
@Api(tags="提现调用的入账接口")
@Controller
@RequestMapping("feign")
public class FeignCommonWithdraw {
	
	@Autowired
	private WithdrawCommonBiz withdrawCommonBiz;
	
	/**
	 * 发起提现申请时调用的接口
	 * @param 
	 * @return withdrawApply
	 */
	@ApiOperation("发起提现申请时调用的接口")
	@RequestMapping(value = "/withdrawApply",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> withdrawApply(@RequestBody @Valid WithdrawApplyRequest withdrawApplyRequest){
		Map<String, Object> response = withdrawCommonBiz.withdrawApply(withdrawApplyRequest);
		return response;
    }
	
	/**
	 * 
	 * 提现失败时解冻资金接口
	 * @param param
	 * @return
	 */
	@ApiOperation("提现失败时解冻资金接口")
	@RequestMapping(value = "/withdrawUnFreeze",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> withdrawUnFreeze(@RequestBody @Valid WithdrawUnFreezeRequest withdrawUnFreezeRequest){
		Map<String, Object> response = withdrawCommonBiz.withdrawUnFreeze(withdrawUnFreezeRequest);
		return response;
    }
	
	/***
	 * 提现成功则需要解冻资金并出账的接口
	 * */
	@ApiOperation("提现成功后解冻资金并出账接口")
	@RequestMapping(value = "/withdrawUnFreAndOutAccount",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> withdrawUnFreAndOutAccount(@RequestBody @Valid WithdrawUnFreAndOutAccountRequest withdrawUnFreAndOutAccountRequest){
		Map<String, Object> response = withdrawCommonBiz.withdrawUnFreAndOutAccount(withdrawUnFreAndOutAccountRequest);
		return response;
    }
	
}
